﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Gueei.Gallery.Web.ViewModels
{
	public class PagingViewModel
	{
		public int Page
		{
			get
			{
				return (int)Math.Ceiling((float)(StartItem + 1) / (float)ItemsPerPage);
			}
		}
		public int StartItem { get; set; }
		public int ItemsPerPage { get; set; }
		public int TotalItem { get; set; }
		public int NextPageStartItem { get { return StartItem + ItemsPerPage; } }
		public int PrevPageStartItem
		{
			get
			{
				var item = StartItem - ItemsPerPage;
				return item < 0 ? 0 : item;
			}
		}
		public bool MorePage
		{
			get
			{ return Page < TotalPage; }
		}
		public int TotalPage
		{
			get
			{
				return (int)Math.Ceiling((double)TotalItem / ItemsPerPage);
			}
		}
	}
}